<?php
class Tourism_collect_shop_model extends CI_Model
{
    private $table = 'tourism_collect_shop';
    
     /**
     * 此站点被多少人收藏
     * @param unknown $providerUid
     */
    public function collectProviderTotal($providerUid){
    	
        $this->db->where('provider_uid',$providerUid);
        return $this->db->count_all_results($this->table);
    }
    
    /**
     * 
     * @param unknown $userUid
     * @param unknown $providerUid
     * return false 和 true
     */
    public function isCollectProviderByUid($userUid,$providerUid){
    	
        $this->db->where('user_uid',$userUid);
        $this->db->where('provider_uid',$providerUid);
        $result = $this->db->get($this->table);
        return $result->num_rows() > 0 ? true :false ; 
    }
    
    public function insertCollectShop($param){
    	
        $data = array(
        	'user_uid'  =>  $param['userUid'],
            'provider_uid' => $param['providerUid'],
            'collect_time' => date('Y-m-d H:i:s')
        );
        return $this->db->insert($this->table,$data);
    }
    
}